<?php
	session_start();
	require("../inc/functions.php");
	if(!isEmployee())
		header("Location: ../index.php");
	require_once("../inc/models/customer_model.php");
	$results = GetCustomers();
	if(isset($POST['login']))
		LoginUser($POST);
?>

<!DOCTYPE html>
<html lang="en">
	<?php include('../inc/head.php'); ?>
	<body>
	<?php include('../inc/navigation.php'); ?>
			<div class="span9">
				<div class="row-fluid">
					<h2>Customers</h2>
					<hr>
					<p class="btn btn-success"><a style="color:white;" href="create.php">Create</a></p>
					<table class="table table-striped">
		                <thead>
		                	<th>I.D.</th>
		                    <th>First Name</th>
		          			<th>Last Name</th>
		                    <th>Actions</th>
		                </thead>
		            	<? while($rs = $results->fetch_assoc()) : ?>
		                <tr>
		                	<td><?=$rs['id']?></td>
		                    <td><?=$rs['first_name']?></td>
		                    <td><?=$rs['last_name']?></td>
		                    <td>
		                        <a href="details.php?id=<?=$rs['id']?>">Details</a>
		                        <a href="edit.php?id=<?=$rs['id']?>">Edit</a>
		                        <a href="delete.php?id=<?=$rs['id']?>" onClick="return confirm('Are you sure you want to delete this entry?')">Delete</a>
		                    </td>
		            	<? endwhile; ?>
		            </table>
				</div>
			</div>
		</div>
	</div>
	
	<!-- All Bootstrap JavaScript Files -->
	<script src="../inc/bootstrap/js/jquery.js"></script>
    <script src="../inc/bootstrap/js/bootstrap.js"></script>
	
	</body>
</html>
